package com.zzh.compilation.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("Enter Your words(end with #):");
            String input = scanner.nextLine();
            if (input.endsWith("#")) {
                input = input.substring(0, input.length() - 1);
                MyScanner scannerObj = new MyScanner(input);
                List<Word> tokenList = new ArrayList<>();
                Word word;
                do {
                    word = scannerObj.scan();
                    tokenList.add(word);
                } while (word.getTypeNum()!= 1000);
                Parser parser = new Parser(tokenList);
                parser.parse();
                if (scanner.next().charAt(0) == '#') {
                    break;
                }
            }
        }
    }
}